<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>结构伪类选择器</title>
    <style>
        div{
            border: 1px solid black;
        }
        /* 只有一个元素 */
        div p:only-child{
            background: red;
        }
    </style>
</head>
<body>
    <div>
        <p>11111111</p>
        <p>22222222</p>
    </div>
    <div>
        <p>33333333</p>
    </div>
</body>
</html>